package com.u3k.mid;

import android.content.Context;
import com.u3k.app.mid.utils.common.PathUtil;
import com.u3k.app.mid.utils.statistics.StatisticsManager;
import java.io.File;

public class v {
    private static final String a = v.class.getSimpleName();

    public static Object a(Context context, String str, String str2, String str3) {
        Object obj = null;
        LogUtils.LogError(a, "loadObject  moduleName=" + str + ", version=" + str2 + ", className=" + str3);
        String a = a(context, str, str2);
        String str4 = a + "lib.odex";
        LogUtils.LogError(a, "loadObject   srcLibPath=" + str4);
        if (new File(str4).exists()) {
            LogUtils.LogError(a, "loadObject   oriLib.exists");
            String str5 = a + "declib.dex";
            ac.a(str4, str5);
            a = a + "odex";
            File file = new File(a);
            if (!file.exists()) {
                file.mkdirs();
            }
            try {
                obj = new aa(str5, a, null, v.class.getClassLoader()).loadClass(str3).newInstance();
                File file2 = new File(str5);
                if (file2 != null) {
                    file2.delete();
                }
            } catch (Exception e) {
                e.printStackTrace();
                LogUtils.LogError(a, "loadObject   ClassNotFoundException=" + e.getMessage());
                StatisticsManager.getInstance().logException(ae.a(), e);
            } catch (Exception e2) {
                e2.printStackTrace();
                LogUtils.LogError(a, "loadObject   InstantiationException=" + e2.getMessage());
                StatisticsManager.getInstance().logException(ae.a(), e2);
            } catch (Exception e22) {
                e22.printStackTrace();
                LogUtils.LogError(a, "loadObject   IllegalAccessException=" + e22.getMessage());
                StatisticsManager.getInstance().logException(ae.a(), e22);
            } catch (Exception e222) {
                StatisticsManager.getInstance().logException(ae.a(), e222);
            }
        }
        return obj;
    }

    public static String a(Context context, String str) {
        return PathUtil.getFilesDir(context).getAbsolutePath() + File.separator + "libs" + File.separator + str;
    }

    public static String a(Context context, String str, String str2) {
        return PathUtil.getFilesDir(context).getAbsolutePath() + File.separator + "libs" + File.separator + str + File.separator + str2 + File.separator;
    }

    public static boolean a(Context context, String str, String str2, long j) {
        String str3 = a(context, str, str2) + "lib.odex";
        return new File(str3).exists() && al.a(str3) == j;
    }
}
